import { http } from "@/utils/http";
import { baseUrlApi } from "@/store/utils";

//----------------------------------------供货订单----------------------------------------//
//获取供货订单列表
export const getsupplyOrderOrderlist = (params?: object) => {
  return http.request("get", baseUrlApi("supplyOrder/list"), { params });
};

//获取供货订单信息详情
export const getsupplyOrderOrderinfo = (params?: object) => {
  return http.request("get", baseUrlApi("supplyOrder/info"), { params });
};

//获取供货订单订单材料信息;
export const getmateriallistview = (params?: object) => {
  return http.request("get", baseUrlApi("supplyOrder/material/list"), {
    params
  });
};

//获取供货订单订单材料信息
export const getmateriallist = (params?: object) => {
  return http.request("get", baseUrlApi("supplyOrder/shipment/material/list"), {
    params
  });
};

//获取供货订单收货人信息
export const getconsigneelist = (params?: object) => {
  return http.request("get", baseUrlApi("supplyOrder/consignee/list"), {
    params
  });
};

//保存/编辑供货订单(id存在为编辑)
export const supplyOrderOrdersaveOrUpdate = (data?: object) => {
  return http.request("post", baseUrlApi("supplyOrder/saveOrUpdate"), { data });
};

///编辑供货订单收货人(id存在为编辑)
export const consigneesaveOrUpdate = (data?: object) => {
  return http.request(
    "post",
    baseUrlApi("supplyOrder/consignee/saveOrUpdate"),
    { data }
  );
};

///编辑供货订单材料(id存在为编辑)
export const materialaveOrUpdate = (data?: object) => {
  return http.request("post", baseUrlApi("supplyOrder/material/saveOrUpdate"), {
    data
  });
};
//删除供货订单
export const deletesupplyOrder = (data?: object) => {
  return http.request("post", baseUrlApi("supplyOrder/deleteById"), { data });
};
//删除订单材料
export const deletematerial = (data?: object) => {
  return http.request("post", baseUrlApi("supplyOrder/material/deleteById"), {
    data
  });
};
//删除订单收货人
export const deleteconsignee = (data?: object) => {
  return http.request("post", baseUrlApi("supplyOrder/consignee/deleteById"), {
    data
  });
};
//单次供货多次供货
export const saveposupply = (data?: object) => {
  return http.request("post", baseUrlApi("supplyOrder/save/posupply"), {
    data
  });
};
//订单确认
export const updatecommitAudit = (data?: object) => {
  return http.request("post", baseUrlApi("supplyOrder/commitAudit"), {
    data
  });
};

//----------------------------------------供货清单----------------------------------------//
//获取供货清单列表
export const getsosupplylist = (params?: object) => {
  return http.request("get", baseUrlApi("posupply/list"), { params });
};
//获取供货清单详情
export const getposupplyinfo = (params?: object) => {
  return http.request("get", baseUrlApi("posupply/info"), { params });
};
//获取供货清单详情
export const getposupplymaterial = (params?: object) => {
  return http.request("get", baseUrlApi("posupply/material/list"), { params });
};
//获取供货清单合同数据列表
export const getposupplywirepayinfo = (params?: object) => {
  return http.request("get", baseUrlApi("posupply/wire/pay/info"), { params });
};
//供货清单生成对账单
export const getposupplysave = (data?: object) => {
  return http.request("post", baseUrlApi("posupply/save"), { data });
};
//上传供货单
export const getposupplyupload = (data?: object) => {
  return http.request("post", baseUrlApi("posupply/uploade"), { data });
};

//云采确认
export const updateposupplycommitAudit = (data?: object) => {
  return http.request("post", baseUrlApi("posupply/commitAudit"), {
    data
  });
};

//确认历史列表
export const auditconfirmhistorylist = (params?: object) => {
  return http.request("get", baseUrlApi("audit/confirm/history/list"), {
    params
  });
};
